home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 11262 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.8 KB

  1. Path: erich.triumf.ca!bennett
  2. From: bennett@erich.triumf.ca (P.Bennett)
  3. Newsgroups: comp.lang.c++,comp.lang.c
  4. Subject: Re: HELP!: Error when trying to use cout in MSVC++ 4.0!
  5. Date: 13 Mar 1996 07:40 PST
  6. Organization: TRIUMF: Tri-University Meson Facility
  7. Distribution: world
  8. Message-ID: <13MAR199607405255@erich.triumf.ca>
  9. References: <4i5kpd$eic@mirv.unsw.edu.au>
  10. NNTP-Posting-Host: ftp.triumf.ca
  11. News-Software: VAX/VMS VNEWS 1.50    
  12.  
  13. In article <4i5kpd$eic@mirv.unsw.edu.au>, s2139589@cse.unsw.edu.au (CC) writes...
  14. >Hi,
  15. >I am having trouble compiling a very simple program consisting of one
  16. >line of code in main(). I am using Microsoft Visual C++ Version 4.0 on
  17. >WIN95.  Basically I am trying to use cout to print a word, however the
  18. >compiler keeps generating the following error:
  19. >E:\Labs\lab1.c(4) : error C2065: 'cout' : undeclared identifier
  20. >E:\Labs\lab1.c(4) : error C2297: '<<' : bad right operand
  21. >Error executing cl.exe.
  22. >lab1.obj - 2 error(s), 0 warning(s)
  23.  
  24. Quite likely your compiler thinks you are writing C, but cout only exists in
  25. C++.
  26.  
  27. My Borland C++ will compile either C or C++, depending on the source file
  28. extension - if it's .c, then it is assumed to be C.   If the extension is .cpp,
  29. it is assumed to be C++.  MSVC may do the same....  (or  there may be a switch
  30. somewhere to tell it to compile C++ regardless)
  31.  
  32. Peter Bennett VE7CEI                | Vessels shall be deemed to be in sight
  33. Internet: bennett@triumf.ca         | of one another only when one can be
  34. Packet: ve7cei@ve7kit.#vanc.bc.ca   | observed visually from the other
  35. TRIUMF, Vancouver, B.C., Canada     |                          ColRegs 3(k)
  36. GPS and NMEA info and programs: ftp://sundae.triumf.ca/pub/peter/index.html
  37. or: ftp://ftp-i2.informatik.rwth-aachen.de/pub/arnd/GPS/peter/index.html
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.